package com.yipao.db.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import com.yipao.db.domain.goods.Category;
import com.yipao.db.domain.goods.CategoryExample;

/**
 * 分类
 *
 * @author tianhao
 */
public interface CategoryMapper {

    long countByExample(CategoryExample example);

    int deleteByExample(CategoryExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Category record);

    int insertSelective(Category record);

    Category selectOneByExample(CategoryExample example);

    Category selectOneByExampleSelective(@Param("example") CategoryExample example, @Param("selective") Category.Column... selective);

    List<Category> selectByExampleSelective(@Param("example") CategoryExample example, @Param("selective") Category.Column... selective);


    List<Category> selectByExample(CategoryExample example);

    Category selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") Category.Column... selective);

    /**
     * This method corresponds to the database table yipao_category
     *
     * @mbg.generated
     */
    Category selectByPrimaryKey(Integer id);

    /**
     * This method corresponds to the database table yipao_category
     *
     * @mbg.generated
     */
    Category selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);

    /**
     * This method corresponds to the database table yipao_category
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") Category record, @Param("example") CategoryExample example);


    int updateByExample(@Param("record") Category record, @Param("example") CategoryExample example);


    int updateByPrimaryKeySelective(Category record);


    int updateByPrimaryKey(Category record);

    int logicalDeleteByExample(@Param("example") CategoryExample example);

    int logicalDeleteByPrimaryKey(Integer id);

    /**
     * 根据id查询分类名称
     *
     * @param id
     * @return
     */
    String findNameById(Integer id);

    /**
     * 查询设备下的商品分类
     *
     * @param devId   设备id
     * @param deleted 删除状态
     * @return
     */
    List<Category> queryByDevId(@Param("devId") Integer devId, @Param("deleted") Integer deleted);
}
